3.4.5 \(\int (a+a \cos (c+d x)) (A+B \cos (c+d x)+C \cos ^2(c+d x)) \sec ^2(c+d x) \, dx\) [305]

3.4.5.1 Optimal result
3.4.5.2 Mathematica [A] (verified)
3.4.5.3 Rubi [A] (verified)
3.4.5.4 Maple [A] (verified)
3.4.5.5 Fricas [A] (verification not implemented)
3.4.5.6 Sympy [F]
3.4.5.7 Maxima [A] (verification not implemented)
3.4.5.8 Giac [B] (verification not implemented)
3.4.5.9 Mupad [B] (verification not implemented)

3.4.5.1 Optimal result

Integrand size = 39, antiderivative size = 46 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=a (B+C) x+\frac {a (A+B) \text {arctanh}(\sin (c+d x))}{d}+\frac {a C \sin (c+d x)}{d}+\frac {a A \tan (c+d x)}{d} \]

output
a*(B+C)*x+a*(A+B)*arctanh(sin(d*x+c))/d+a*C*sin(d*x+c)/d+a*A*tan(d*x+c)/d
 
3.4.5.2 Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.54 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=a B x+a C x+\frac {a A \text {arctanh}(\sin (c+d x))}{d}+\frac {a B \text {arctanh}(\sin (c+d x))}{d}+\frac {a C \cos (d x) \sin (c)}{d}+\frac {a C \cos (c) \sin (d x)}{d}+\frac {a A \tan (c+d x)}{d} \]

input
Integrate[(a + a*Cos[c + d*x])*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec 
[c + d*x]^2,x]
 
output
a*B*x + a*C*x + (a*A*ArcTanh[Sin[c + d*x]])/d + (a*B*ArcTanh[Sin[c + d*x]] 
)/d + (a*C*Cos[d*x]*Sin[c])/d + (a*C*Cos[c]*Sin[d*x])/d + (a*A*Tan[c + d*x 
])/d
 
3.4.5.3 Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3042, 3510, 25, 3042, 3502, 3042, 3214, 3042, 4257}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sec ^2(c+d x) (a \cos (c+d x)+a) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (a \sin \left (c+d x+\frac {\pi }{2}\right )+a\right ) \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )^2}dx\)

\(\Big \downarrow \) 3510

\(\displaystyle \frac {a A \tan (c+d x)}{d}-\int -\left (\left (a C \cos ^2(c+d x)+a (B+C) \cos (c+d x)+a (A+B)\right ) \sec (c+d x)\right )dx\)

\(\Big \downarrow \) 25

\(\displaystyle \int \left (a C \cos ^2(c+d x)+a (B+C) \cos (c+d x)+a (A+B)\right ) \sec (c+d x)dx+\frac {a A \tan (c+d x)}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {a C \sin \left (c+d x+\frac {\pi }{2}\right )^2+a (B+C) \sin \left (c+d x+\frac {\pi }{2}\right )+a (A+B)}{\sin \left (c+d x+\frac {\pi }{2}\right )}dx+\frac {a A \tan (c+d x)}{d}\)

\(\Big \downarrow \) 3502

\(\displaystyle \int (a (A+B)+a (B+C) \cos (c+d x)) \sec (c+d x)dx+\frac {a A \tan (c+d x)}{d}+\frac {a C \sin (c+d x)}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {a (A+B)+a (B+C) \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )}dx+\frac {a A \tan (c+d x)}{d}+\frac {a C \sin (c+d x)}{d}\)

\(\Big \downarrow \) 3214

\(\displaystyle a (A+B) \int \sec (c+d x)dx+\frac {a A \tan (c+d x)}{d}+a x (B+C)+\frac {a C \sin (c+d x)}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle a (A+B) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx+\frac {a A \tan (c+d x)}{d}+a x (B+C)+\frac {a C \sin (c+d x)}{d}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {a (A+B) \text {arctanh}(\sin (c+d x))}{d}+\frac {a A \tan (c+d x)}{d}+a x (B+C)+\frac {a C \sin (c+d x)}{d}\)

input
Int[(a + a*Cos[c + d*x])*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d 
*x]^2,x]
 
output
a*(B + C)*x + (a*(A + B)*ArcTanh[Sin[c + d*x]])/d + (a*C*Sin[c + d*x])/d + 
 (a*A*Tan[c + d*x])/d
 

3.4.5.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3214
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d   Int[1/(c + d 
*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3502
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co 
s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m 
+ 2))   Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m 
 + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] 
 &&  !LtQ[m, -1]
 

rule 3510
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + 
 (f_.)*(x_)])*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f 
_.)*(x_)]^2), x_Symbol] :> Simp[(-(b*c - a*d))*(A*b^2 - a*b*B + a^2*C)*Cos[ 
e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b^2*f*(m + 1)*(a^2 - b^2))), x] - S 
imp[1/(b^2*(m + 1)*(a^2 - b^2))   Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[b*( 
m + 1)*((b*B - a*C)*(b*c - a*d) - A*b*(a*c - b*d)) + (b*B*(a^2*d + b^2*d*(m 
 + 1) - a*b*c*(m + 2)) + (b*c - a*d)*(A*b^2*(m + 2) + C*(a^2 + b^2*(m + 1)) 
))*Sin[e + f*x] - b*C*d*(m + 1)*(a^2 - b^2)*Sin[e + f*x]^2, x], x], x] /; F 
reeQ[{a, b, c, d, e, f, A, B, C}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 
 0] && LtQ[m, -1]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 
3.4.5.4 Maple [A] (verified)

Time = 4.80 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.46

method result size
parts \(\frac {a A \tan \left (d x +c \right )}{d}+\frac {\left (a A +B a \right ) \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {\left (B a +a C \right ) \left (d x +c \right )}{d}+\frac {a C \sin \left (d x +c \right )}{d}\) \(67\)
derivativedivides \(\frac {a A \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B a \left (d x +c \right )+a C \sin \left (d x +c \right )+a A \tan \left (d x +c \right )+B a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+a C \left (d x +c \right )}{d}\) \(74\)
default \(\frac {a A \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B a \left (d x +c \right )+a C \sin \left (d x +c \right )+a A \tan \left (d x +c \right )+B a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+a C \left (d x +c \right )}{d}\) \(74\)
parallelrisch \(-\frac {a \left (\cos \left (d x +c \right ) \left (A +B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\cos \left (d x +c \right ) \left (A +B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {\sin \left (2 d x +2 c \right ) C}{2}-d x \left (B +C \right ) \cos \left (d x +c \right )-A \sin \left (d x +c \right )\right )}{d \cos \left (d x +c \right )}\) \(95\)
risch \(a B x +a C x -\frac {i a C \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a C}{2 d}+\frac {2 i a A}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {a A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}+\frac {B a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {a A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}-\frac {B a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) \(143\)
norman \(\frac {\left (-B a -a C \right ) x +\left (-2 B a -2 a C \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (B a +a C \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (2 B a +2 a C \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {2 a \left (A -C \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 a \left (A +C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 a \left (3 A -C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 a \left (3 A +C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {a \left (A +B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {a \left (A +B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(236\)

input
int((a+cos(d*x+c)*a)*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x,method 
=_RETURNVERBOSE)
 
output
a*A*tan(d*x+c)/d+(A*a+B*a)/d*ln(sec(d*x+c)+tan(d*x+c))+(B*a+C*a)/d*(d*x+c) 
+a*C*sin(d*x+c)/d
 
3.4.5.5 Fricas [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 92, normalized size of antiderivative = 2.00 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\frac {2 \, {\left (B + C\right )} a d x \cos \left (d x + c\right ) + {\left (A + B\right )} a \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (A + B\right )} a \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (C a \cos \left (d x + c\right ) + A a\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]

input
integrate((a+a*cos(d*x+c))*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x, 
 algorithm="fricas")
 
output
1/2*(2*(B + C)*a*d*x*cos(d*x + c) + (A + B)*a*cos(d*x + c)*log(sin(d*x + c 
) + 1) - (A + B)*a*cos(d*x + c)*log(-sin(d*x + c) + 1) + 2*(C*a*cos(d*x + 
c) + A*a)*sin(d*x + c))/(d*cos(d*x + c))
 
3.4.5.6 Sympy [F]

\[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=a \left (\int A \sec ^{2}{\left (c + d x \right )}\, dx + \int A \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int B \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int B \cos ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int C \cos ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int C \cos ^{3}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx\right ) \]

input
integrate((a+a*cos(d*x+c))*(A+B*cos(d*x+c)+C*cos(d*x+c)**2)*sec(d*x+c)**2, 
x)
 
output
a*(Integral(A*sec(c + d*x)**2, x) + Integral(A*cos(c + d*x)*sec(c + d*x)** 
2, x) + Integral(B*cos(c + d*x)*sec(c + d*x)**2, x) + Integral(B*cos(c + d 
*x)**2*sec(c + d*x)**2, x) + Integral(C*cos(c + d*x)**2*sec(c + d*x)**2, x 
) + Integral(C*cos(c + d*x)**3*sec(c + d*x)**2, x))
 
3.4.5.7 Maxima [A] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 92, normalized size of antiderivative = 2.00 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\frac {2 \, {\left (d x + c\right )} B a + 2 \, {\left (d x + c\right )} C a + A a {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + B a {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, C a \sin \left (d x + c\right ) + 2 \, A a \tan \left (d x + c\right )}{2 \, d} \]

input
integrate((a+a*cos(d*x+c))*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x, 
 algorithm="maxima")
 
output
1/2*(2*(d*x + c)*B*a + 2*(d*x + c)*C*a + A*a*(log(sin(d*x + c) + 1) - log( 
sin(d*x + c) - 1)) + B*a*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 
 2*C*a*sin(d*x + c) + 2*A*a*tan(d*x + c))/d
 
3.4.5.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 132 vs. \(2 (46) = 92\).

Time = 0.37 (sec) , antiderivative size = 132, normalized size of antiderivative = 2.87 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\frac {{\left (B a + C a\right )} {\left (d x + c\right )} + {\left (A a + B a\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (A a + B a\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + C a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 1}}{d} \]

input
integrate((a+a*cos(d*x+c))*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x, 
 algorithm="giac")
 
output
((B*a + C*a)*(d*x + c) + (A*a + B*a)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 
(A*a + B*a)*log(abs(tan(1/2*d*x + 1/2*c) - 1)) - 2*(A*a*tan(1/2*d*x + 1/2* 
c)^3 - C*a*tan(1/2*d*x + 1/2*c)^3 + A*a*tan(1/2*d*x + 1/2*c) + C*a*tan(1/2 
*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^4 - 1))/d
 
3.4.5.9 Mupad [B] (verification not implemented)

Time = 1.60 (sec) , antiderivative size = 153, normalized size of antiderivative = 3.33 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\frac {A\,a\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {2\,A\,a\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,a\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,C\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {C\,a\,\sin \left (2\,c+2\,d\,x\right )}{2\,d\,\cos \left (c+d\,x\right )} \]

input
int(((a + a*cos(c + d*x))*(A + B*cos(c + d*x) + C*cos(c + d*x)^2))/cos(c + 
 d*x)^2,x)
 
output
(A*a*tan(c + d*x))/d + (2*A*a*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)) 
)/d + (2*B*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*B*a*atanh 
(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*C*a*atan(sin(c/2 + (d*x)/2 
)/cos(c/2 + (d*x)/2)))/d + (C*a*sin(2*c + 2*d*x))/(2*d*cos(c + d*x))